package com.aidong.stadium.biz.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.aidong.myprofile.dao.MyAppointmentDao;
import com.aidong.stadium.biz.MstCoachBiz;
import com.aidong.stadium.dao.MstCoachDao;
import com.aidong.stadium.entity.MstCoach;

@Service("mstCoachBiz")
public class MstCoachBizImpl implements MstCoachBiz {
	
	private MstCoachDao mstCoachDao;
	
	private MyAppointmentDao appointmentDao;
	
	@Autowired
	public void setAppointmentDao(MyAppointmentDao appointmentDao) {
		this.appointmentDao = appointmentDao;
	}
	
	@Autowired
	public void setMstCoachDao(MstCoachDao mstCoachDao) {
		this.mstCoachDao = mstCoachDao;
	}

	/**
	 * 查找门店下可以预约的私人教练
	 * @param storeId
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getMstCoach(int storeId) {
		return mstCoachDao.getMstCoach(storeId);
	}
	
	/**
	 * 私教介绍
	 * @param CoachID
	 * @return
	 */
	@Override
	public Map<String, Object> getMstCoachDetail(int coachId) {
		return mstCoachDao.getMstCoachDetail(coachId);
	}

	/**
	 * 私教不可预约时间排班表
	 * @param coachId
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getTrnPtUnsubscribe(int coachId) {
		return mstCoachDao.getTrnPtUnsubscribe(coachId);
	}
	
	/**
	 * 查看该私教是否已预约
	 * @param map
	 * @return
	 */
	@Override
	public int getIfAppointPt(Map<String, Object> map) {
		return mstCoachDao.getIfAppointPt(map);
	}

	/**
	 * 保存私教预约记录 
	 * @param coach
	 */
	@Override
	public void addTrnPtUnsubscribe(MstCoach coach) {
		mstCoachDao.addTrnPtUnsubscribe(coach);
		// 预约标记位
		Map<String, Object> paraMap = new HashMap<String, Object>();
		paraMap.put("status", 0);
		paraMap.put("idongId", coach.getIdongId());
		appointmentDao.eidtMemberAppointFlg(paraMap);
	}

	/**
	 * 预约提醒信息
	 * @param coachId
	 * @return
	 */
	@Override
	public Map<String, String> getCoachAppointRemind(int coachId) {
		return mstCoachDao.getCoachAppointRemind(coachId);
	}

}
